package com.Annotation2;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class SelfAnnoMain {
    public static void main(String[] args) throws Exception {

        System.out.println("获取实现类Message1 上的注解信息");
        Class<?> clazzImpl = Message1.class;
        for (Annotation anno:clazzImpl.getAnnotations()) {
            System.out.println(anno);
        }

        System.out.println("获取方法上的注解信息");
        Class<?> clazz1 = Message1.class;
        Method method = clazz1.getDeclaredMethod("echo",String.class);
        for (Annotation an: method.getAnnotations()) {
            System.out.println(an);
        }
    }
}
